<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var score = 90;
        // 将数字缩小10 取整-刚好能拿到 十位数字
        var num = parseInt(score / 10);
        console.log(num);
        var res;
        switch (num) {
            case 10:
            case 9:
                res = '优秀'
                break;
            case 8:
            case 7:
                res = '良好'
                break;
            case 6:
                res = '及格'
                break;
            default:
                res = '不及格'
                break;
        }
        console.log(res);
    </script>

</body>

</html>